#include<bits/stdc++.h>
#define sd(n) scanf("%d",&n) 
#define sld(n) scanf("%lld",&n)
#define pd(n) printf("%d", (n))
#define pld(n) printf("%lld", n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fi first
#define se second
const int N = 2e5;
const int maxn = 1e6;
typedef long long int ll;
using namespace std;
//----------------------------------------------------------------------------//

void solve()
{
	int n;
	sd(n);
	map<int, int> cnt;
	for (int i = 0; i < n; i++)
	{
		int x;
		sd(x);
		while (x > n)//先不断除2让其小于n
		{
			x /= 2;
		}
		while (cnt[x] !=0 && x != 0)//找第一个未标记的x,且是从大的往小的找,范围一直都在x中
		{
			x /= 2;
		}
		cnt[x]++;//如果有重复,上面会一直除直到位0跳出
	}
	int flag = 0;
	for (int i = 1; i <= n; i++)
	{
		if (cnt[i] == 0)
		{
			flag = 1;
			break;
		}
	}
	if (flag == 0) puts("YES");
	else puts("NO");

}

int main()
{
	int T;
	sd(T);
	while (T--)
	{
		solve();
	}
	return 0;
}